const { Result } = require('../utils')

module.exports = async (ctx, next) => {
    try {
        await next()
    } catch (err) {
        ctx.status = err.status || 500
        ctx.body = Result.error(ctx.status, null, err.message)
    }
}
